package com.codesuc.aichat.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName MybatisPlusPageConfig
 * @Description MybatisPlus分页配置类
 * @Author Mr.Zhang
 * @Date 2025/08/02 下午3:34
 * @Version 1.0
 */
@Configuration
public class MybatisPlusPageConfig {

    /**
     * 新版本分页插件配置
     *
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));  // PaginationInnerInterceptor()  分页内部的插件
        return interceptor;
    }
}
